<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>阶乘递归</title>
</head>
<body>

<script>

    function b(n){

        if (n === 1){
            return 1
        }else {
            return n * b(n - 1);
        }

        //5 * (5 - 1)   4   24 * 5 =120
        //4 * (4 - 1)   3   6 * 4 =24
        //3 * (3 - 1)   2   2 * 3 =6
        //2 * (2 - 1)   1   1 * 2 =2
    }

    console.log(b(5));
    console.log(b(10));

</script>



</body>
</html>